package com.nodecollege.cloud.controller;

import com.alibaba.fastjson.JSONObject;
import com.nodecollege.cloud.common.model.NCResult;
import com.nodecollege.cloud.common.model.vo.ChatData;
import com.nodecollege.cloud.service.ChatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author LC
 * @date 2020/2/27 14:20
 */
@RestController
@RequestMapping("/chatHandler")
public class ChatHandlerController {

    @Autowired
    private ChatService chatService;


    @PostMapping("/handler")
    public NCResult chatHandler(@RequestBody ChatData chatData){
        chatService.handler(JSONObject.toJSONString(chatData), null);
        return NCResult.ok();
    }
}
